#include "caboutdlg.h"
#include "cglobal.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QIcon>
#include <QDebug>

CAboutDlg::CAboutDlg(QWidget *parent)
    : QDialog(parent)
{
    //setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setWindowTitle(A2T("关于"));
    QGridLayout *pGridLayout = new QGridLayout;
    pGridLayout->setContentsMargins(20, 10, 20, 10);
    pGridLayout->setSpacing(10);
    setLayout(pGridLayout);

    QLabel *pLogoLabel = new QLabel;
    pLogoLabel->setObjectName("LogoLabel");
    pLogoLabel->setStyleSheet("QLabel#LogoLabel"
                              "{"
                              "min-width: 90px;"
                              "min-height: 90px;"
                              "border-image: url(:/icon/myapp.ico);"
                              "}");
    pLogoLabel->setMinimumSize(90,90);
    pGridLayout->addWidget(pLogoLabel, 0, 0, 3, 3);

    QLabel *pLabel = new QLabel(A2T("科远采集管理程序"));
    pGridLayout->addWidget(pLabel, 0, 3);

    QString strVersion = tr("Version:");
    strVersion += "1.0.0";
    pLabel = new QLabel(strVersion);
    pGridLayout->addWidget(pLabel, 1, 3);

    pLabel = new QLabel(tr("Copyright \302\251 2020-2026 Sciyon"));
    pGridLayout->addWidget(pLabel, 2, 3);
}

CAboutDlg::~CAboutDlg()
{
    qDebug() << this->size();
    qDebug() << this->rect().size();
}
